package drds.configuration.web.module.admin;


import drds.configuration.mvc.aop.interceptor.impl.LoginInterceptor;
import drds.configuration.mvc.core.Controller;
import drds.configuration.mvc.core.annotation.actionbind.ActionKey;
import drds.configuration.mvc.util.WebApp;
import drds.configuration.web.model.drds_home.datasource.DatabaseUser;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author caozhenghui@drds.team<330937205@qq.com>
 */
@ActionKey("/admin")
public class AdminAction extends Controller {
    /**
     * 进行页面导航
     */

    @ActionKey("/index")
    public void index() {

        DatabaseUser databaseUser = null;

        databaseUser.setAddDateTime(null);
        databaseUser.save();


        HttpServletRequest request = getRequest();
        renderJsp("/admin/index.html");
        return;
    }

    @ActionKey("/check")
    public void main() {
        HttpServletRequest request = getRequest();
        renderJsp("/admin/index.jsp");
        return;
    }

    @ActionKey("/exit")
    public void exit() {

        removeSessionAttribute(LoginInterceptor.LoginState);
        //
        HttpSession session = getSession();
        session.invalidate();
        HttpServletRequest request = getRequest();
        String __ROOT_PATH__ = WebApp.getWebRootPath(request);
        renderHttp(__ROOT_PATH__);
        return;
    }
}
